#include <stdio.h>
#include <math.h>
#define dx 0.1
static inline double res(double x, double y);

static inline double res(double x, double y)
{
    return y - 2 * x / y;
}

int main()
{
    double y0 = 1.0;
    double x0 = 0.0;
    double k1, k2, k3;
    double yn1;

    for (int i = 0; i <= 8; i++)
    {
        k1 = res(x0, y0);
        k2 = res(x0 + 0.5 * dx, y0 + 0.5 * dx * k1);
        k3 = res(x0 + dx, y0 - dx * k1 + 2 * dx * k2);
        yn1 = y0 + dx / 6 * (k1 + 4 * k2 + k3);
        x0 = x0 + dx;
        y0 = yn1;
        printf("location: %lf   value:  %lf\n", x0, yn1);
    }
    return 0;
}